#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define N 10010

struct Point {
    int x;
    int y;
};
Point p[N][2];
Point dot;
Point tp[N];

bool cmpx(Point a, Point b) {
    if ( a.x == b.x )
        return a.y < b.y;
    else
        return a.x < b.x;
}

bool cmpy(Point a, Point b) {
    if ( a.y == b.y )
        return a.x < b.x;
    else
        return a.y < b.y;
}

bool OnBorder(Point *a, Point *b, Point *c) {
    if ( a->y == b->y &&
         ((a->x <= c->x && c->x <= b->x) || (a->x >= c->x && c->x >= b->x))) {
        return (a->y == c->y) ? true : false;
    }
    if ( a->x == c->x &&
         ((a->y <= c->y && c->y <= b->y) || (a->y >= c->y && c->y >= b->y))) {
        return true;
    }
    return false;
}

bool cross(Point *a, Point *b, Point *c) {
    if (((a->y > c->y && b->y <= c->y) || (a->y <= c->y && b->y > c->y)) &&
        c->x < a->x ) {
        return true;
    }
    return false;
}

int main() {
    int i, j, n;
    // freopen("E.in", "r", stdin);
    // freopen("E.out", "w", stdout);
    while (cin >> n) {
        for (i = 0; i < n; i++) {
            cin >> tp[i].x >> tp[i].y;
            // cin>>p[i][0].x>>p[i][0].y>>p[i][1].x>>p[i][1].y;
        }
        cin >> dot.x >> dot.y;

        sort(tp, tp + n, cmpx);
        int c = 0;
        for (i = 0; i < n; i += 2) {
            p[c][0].x = tp[i].x;
            p[c][0].y = tp[i].y;
            p[c][1].x = tp[i + 1].x;
            p[c][1].y = tp[i + 1].y;
            c++;
        }

        int flag = 0;
        for (i = 0; i < n; i++) {
            if ( OnBorder(&p[i][0], &p[i][1], &dot)) {
                flag = 1;
                break;
            }
        }
        if ( flag ) {
            cout << "BORDER" << endl;
            continue;
        }
        int cnt = 0;
        for (i = 0; i < n; i++) {
            if ( cross(&p[i][0], &p[i][1], &dot)) {
                cnt++;
            }
        }
        if ( cnt & 1 ) {
            cout << "INSIDE" << endl;
        } else {
            cout << "OUTSIDE" << endl;
        }
    }
    return 0;
}
